/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;


import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author JY
 */
@Entity
public class Reviews implements Serializable {
//    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @ManyToOne (fetch= FetchType.EAGER)
    private Places place;
//    @OneToOne
//    private Social reviewer;
//    @Column(columnDefinition = "LONGTEXT")
    private String review;
    private Double ambience;
    private Double service;
    private Double food;
    private Double pricing;
    private Double overall;
    private Boolean visible = true;
    private Long reviewedOn;
    @Temporal(TemporalType.TIMESTAMP)
    private Calendar reviewDate;
    
    public Reviews() {
    }
    
    public void createReview(Places place, Double ambience, Double service, Double food, Double pricing, String review, Calendar date) {
       // this.reviewer = reviewer;
        this.place = place;
        this.ambience = ambience;
        this.service = service;
        this.food = food;
        this.pricing = pricing;
        this.overall = (ambience + service + food + pricing) / 4;
        this.review = review;
        this.setReviewDate(date);
    }
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Places getPlace() {
        return place;
    }

    public void setPlace(Places place) {
        this.place = place;
    }

//    public Social getReviewer() {
//        return reviewer;
//    }
//
//    public void setReviewer(Social reviewer) {
//        this.reviewer = reviewer;
//    }

    public String getReview() {
        return review;
    }

    public Double getAmbience() {
        return ambience;
    }

    public void setAmbience(Double ambience) {
        this.ambience = ambience;
    }

    public Double getFood() {
        return food;
    }

    public void setFood(Double food) {
        this.food = food;
    }

    public Double getOverall() {
        return overall;
    }

    public void setOverall(Double overall) {
        this.overall = overall;
    }

    public Double getPricing() {
        return pricing;
    }

    public void setPricing(Double pricing) {
        this.pricing = pricing;
    }

    public Double getService() {
        return service;
    }

    public void setService(Double service) {
        this.service = service;
    }

    public void setReview(String review) {
        this.review = review;
    }

    public Boolean getVisible() {
        return visible;
    }

    public void setVisible(Boolean visible) {
        this.visible = visible;
    }



    /**
     * @return the reviewedOn
     */
    public Long getReviewedOn() {
        return reviewedOn;
    }

    /**
     * @param reviewedOn the reviewedOn to set
     */
    public void setReviewedOn(Long reviewedOn) {
        this.reviewedOn = reviewedOn;
    }

    /**
     * @return the reviewDate
     */
    public Calendar getReviewDate() {
        return reviewDate;
    }

    /**
     * @param reviewDate the reviewDate to set
     */
    public void setReviewDate(Calendar reviewDate) {
        this.reviewDate = reviewDate;
    }

    
    
}
